· Use env(1) in shebangs instead of hardcoding paths.
· $IP is already set in the constructor of Maintenance classes.
· Add sapi guard to some phpunit files.
Change-Id: I6c6fd6c61e2861b5992f2ccd67a4e3f62e2c445e
-#!/usr/bin/php
+#!/usr/bin/env php
<?php
/**
* Other tests for the unicode normalization module.
-#!/usr/bin/php
+#!/usr/bin/env php
<?php
/**
* @file
* http://www.gnu.org/copyleft/gpl.html
*/
-$IP = dirname( __DIR__ );
+if ( PHP_SAPI != 'cli' ) {
+ die( "Run me from the command line please.\n" );
+}
define( 'SELENIUMTEST', true );
-//require_once( __DIR__ . '/../maintenance/commandLine.inc' );
require( __DIR__ . '/../maintenance/Maintenance.php' );
require_once( 'PHPUnit/Runner/Version.php' );
* @file
*/
-// Evaluate the include path relative to this file
-$IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) );
-
// Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once( __DIR__ . "/../../../../maintenance/Maintenance.php" );
require( __DIR__ . "/RandomImageGenerator.php" );
class GenerateRandomImages extends Maintenance {
/* Configuration */
-// Evaluate the include path relative to this file
-$IP = dirname( dirname( __DIR__ ) );
-
// Set a flag which can be used to detect when other scripts have been entered through this entry point or not
define( 'MW_PHPUNIT_TEST', true );
// Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once( dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php" );
class PHPUnitMaintClass extends Maintenance {
* </code>
*/
-$maintenanceDir = dirname( dirname( dirname( __DIR__ ) ) ) . '/maintenance';
-
-require( "$maintenanceDir/Maintenance.php" );
+require( __DIR__ . '/../../../maintenance/Maintenance.php' );
class GenerateJqueryMsgData extends Maintenance {
}
$maintClass = "GenerateJqueryMsgData";
-require_once( "$maintenanceDir/doMaintenance.php" );
+require_once( RUN_MAINTENANCE_IF_MAIN );
*/
header( 'Content-Type: text/javascript; charset=utf-8' );
-require_once '../../../includes/Xml.php';
+require_once __DIR__ . '/../../../includes/Xml.php';
$moduleImplementations = array(
'testUsesMissing' => "
<?php
-
/**
* MediaWikiInstallerTestSuite
*
*
*/
+if ( PHP_SAPI != 'cli' ) {
+ die( "Run me from the command line please.\n" );
+}
+
require_once 'PHPUnit/Framework/TestSuite.php';
require_once ( __DIR__ . '/MediaWikiUserInterfaceTestCase.php' );